<?php 

class Home extends CI_Controller {

	function __construct()
	{
		parent::__construct();
	}

	public function index()
	{		
		if($this->session->userdata('logged_in_jtk'))
		{
			$session_data = $this->session->userdata('logged_in_jtk');
			$data['username'] = $session_data['username'];
			$data['menu'] = 1;
			$data['login'] = 1;
			//$this->load->view('header_view', $data);     
			$this->load->view('home_view', $data);
		}
		else
		{
			//If no session, redirect to login page
			//redirect('home', 'refresh');
			//$data['username'] = "teu login";
			$data['username'] = "";
			$data['menu'] = 0;
			$data['login'] = 0;
			$this->load->view('home_view', $data);
		}
	}
	
	function logout()
	{	
		session_start();
		$this->session->unset_userdata('logged_in_jtk');
		session_destroy();
		redirect('home', 'refresh');
		
	}
}

?>